package XueXi;

import java.util.Scanner;

public class Demo04 {
    public static void main(String[] args) {
        //1~ ? 的阶乘
        //(1)*(1*2)*(1*2*3)*(1*2*3*4)....
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数字");
        int num = scanner.nextInt();
        int sum = 1;
        int a=1;
            for (int i = 1; i <= num; i++) {
               a *=  sum = i * sum;//sum= i * sum 表示一个循环之后的乘积， 需要另外一个变量来接收所有循环乘积的值
            }
        System.out.println(a);
    }
}
